package list;

import java.util.Calendar;

import com.example.androidhw06_tab.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.widget.FrameLayout;
import android.widget.TextView;

public class MyMsgView extends FrameLayout{
	
	TextView msg;
	MyData mData;
	TextView time;
	
	public MyMsgView(Context context){
		super(context);
		LayoutInflater inflater = LayoutInflater.from(context);
		inflater.inflate(R.layout.my_send, this);
		
		msg = (TextView)findViewById(R.id.myMsg);
		time = (TextView)findViewById(R.id.sendTime);
	}
	
	public void setData(MyData data){
		mData = data;
		msg.setText(mData.mMsg);
				
		Calendar cal = Calendar.getInstance();
		String timeToString = String.format("%02d:%02d", cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE));
		time.setText(timeToString);
	}
	
}
